package com.yang.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

@FeignClient(name = "permission-service")
public interface PermissionFeignClient {

    /**
     * 绑定默认角色（普通用户）
     */
    @PostMapping("/permission/bindDefaultRole/{userId}")
    String bindDefaultRole(@PathVariable Long userId);

    /**
     * 查询用户角色码
     */
    @GetMapping("/permission/roleCode/{userId}")
    String getUserRoleCode(@PathVariable Long userId);

    /**
     * 将用户升级为管理员，超管调用
     */
    @PostMapping("/permission/upgradeToAdmin/{userId}")
    int upgradeToAdmin(@PathVariable Long userId);

    /**
     * 将管理员降级为用户，超管调用
     */
    @PostMapping("/permission/downgradeToUser/{userId}")
    int downgradeToUser(@PathVariable Long userId);
}
